home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / AVOGADRO / SCIDISCS / DISC2 / GREENING.SPK / ReadBigNum < prev    next >
Text File  |  1993-11-27  |  5KB  |  108 lines

  1.                                 BIGNUMBERS
  2.  
  3.                               John Greening
  4.  
  5. (These programs may be freely copied provided that this file is
  6. attached and  they are not sold for profit. They are used entirely at
  7. your own risk.) 
  8.  
  9. All the programs in this directory and its sub-directories deal with
  10. big  numbers. BASIC V can handle integers up to 2147483647 (ie.
  11. 2^31-1), but if you want to use larger integers you need special
  12. programs. BASIC V will normally state real numbers to 9 digits plus
  13. the power of ten required. By using extended precision with the
  14. FPEmulator 19 digits can be obtained. If higher precision is required
  15. special programs are again needed.
  16.  
  17. The programs in this directory handle numbers with up to 255 digits.
  18. This limit is set by 255 characters being the longest string that
  19. BASIC V can use. Although most of the work done by the programs  is
  20. carried out using arrays some string properties are employed.
  21.  
  22. All numbers must be entered into these programs as strings of digits
  23. (with a decimal point in the case of reals). There must be no power
  24. signs (ie. ^) or scientific notation (eg. E10). All numbers must be
  25. positive and the results  of any calculations must be positive. Thus
  26. if you subtract it must always be a smaller number from a larger
  27. number.
  28.  
  29. BigIntegr1
  30.  
  31. The program BigIntegr1 will add, subtract, multiply or divide positive      
  32. integers of up to 255 digits. You will be prompted for the maximum
  33. number of digits you wish to use. You will then be prompted for the
  34. first and then the second number. If the product of the two integers
  35. is likely to have more than the maximum number of digits you have set,
  36. you will be warned. You will be asked if you wish to interchange the
  37. numbers. This may be necessary in the cases of subtraction (see
  38. above) or division. If you divide a smaller number by a larger one you
  39. will get the trivial result 0 with a remainder equal to  the smaller
  40. number. You will then be prompted for the action you require,
  41. ie.addition, subtraction, multiplication or division. The result will
  42. appear and you will be prompted for the number you wish to use with
  43. this result. The other prompts will be repeated. Although all this
  44. prompting may be helpful to start with, you may find it tedious
  45. eventually. In this case turn to the next program.
  46.  
  47. BigIntegr2
  48.  
  49. This does the same things as BigIntegr1 but with fewer prompts. You
  50. will be  prompted to enter two numbers, but if you wish to swap them
  51. you must press # (on the right hand keypad or elsewhere). You then
  52. press +, -, * or / (again  on the right hand keypad or elsewhere)
  53. depending on the action you require.  When the result appears you will
  54. be prompted for the number to be used with  this result.
  55.  
  56. BigSqRoots
  57.  
  58. This program calculates the square roots of positive integers or real
  59. numbers having up to 255 digits. (In the case of reals the decimal
  60. point counts as a digit). The result can be given in up to 127 digits.
  61. For an integer you can  always use this number of digits if you wish,
  62. but for reals there is no point in getting a result to more than half
  63. the number of digits of the original number as the accuracy with
  64. which the real number is known does not justify it. Do not rely on
  65. the last digit.
  66.  
  67. BigReals
  68.  
  69.                     USE THIS PROGRAM WITH GREAT CARE!
  70.  
  71. This program carries out the same functions as BigIntegr1 but it
  72. accepts real numbers as well as integers and gives the option of taking
  73. square roots as well as the normal arithmetical functions. The
  74. results of divisions are given as real numbers to the number of digits
  75. requested and remainders are not stated as they have little
  76. meaning in these circumstances.
  77.  
  78. I offer it with some trepidation as it is only too easy for you to get
  79. a false idea of accuracy. This has been discussed to some extent
  80. under BigSqRoots, but it also applies to the normal arithmetic
  81. operations. Thus if you multiply two 50 digit integers together you
  82. will get a 99 or 100 digit product in which every digit is
  83. justified; but if the numbers are reals instead of integers only
  84. the first 50 digits are really worth having because the original
  85. numbers are not known to more than 50 places. Similar problems  can
  86. arise with addition, subtraction and division. So it will be up to you
  87. to decide just how many of the digits offered to you in the results of       calculations you wish to retain.
  88.  
  89.  
  90.  
  91. Directory Mersenne
  92.  
  93. This directory has its own ReadMersen file.
  94.  
  95.  
  96.  
  97. I should like to record the help I have received from Chapter 4 of          
  98. "Microcomputers and Mathematics" by Bruce, Giblin and Rippon, CUP in
  99. the preparation of these programs.
  100.  
  101.  
  102. If you want some interesting big numbers to work on see "The Penguin        
  103. Dictionary of Curious and Interesting Numbers" by David Wells.
  104.  
  105.  
  106. John Greening
  107. 15, Pentland Crescent,
  108. Edinburgh, EH10 6NS